package com.mfp.java.testYou.db.model;

public class AnsweredQuestion extends Entity {

	private static final long serialVersionUID = 7586962777811044982L;

	private Integer questionId;

	private boolean correct;

	private Boolean[] givenAnswers;

	public AnsweredQuestion(int qId) {
		questionId = qId;
	}

	public void setAnswers(Boolean[] answers) {
		givenAnswers = answers;
	}

	public final Integer getQuestionId() {
		return questionId;
	}

	public final void setQuestionId(Integer questionId) {
		this.questionId = questionId;
	}

	public final boolean isCorrect() {
		return correct;
	}

	public final void setCorrect(boolean correct) {
		this.correct = correct;
	}

	public final Boolean[] getGivenAnswers() {
		return givenAnswers;
	}

	public final void setGivenAnswers(Boolean[] givenAnswers) {
		this.givenAnswers = givenAnswers;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getQuestionId());
		sb.append(" given:[");
		for (Boolean b : getGivenAnswers()) {
			sb.append(b);
			sb.append(" ");
			sb.append(isCorrect() ? "T" : "F");
			sb.append(",");
		}
		sb.append("]");
		
		sb.append(isCorrect());

		return sb.toString();
	}
}
